package com.hk.commons.poi.excel.read.sax.v03.handler;

import com.hk.commons.poi.excel.read.sax.v03.XlsReadContext;
import org.apache.poi.hssf.record.LabelSSTRecord;
import org.apache.poi.hssf.record.Record;

/**
 * 引用了SSTRecord中一个String类型的单元格值
 *
 * @author Kevin
 */
public class LabelSSTRecordHandler implements XlsRecordHandler {

    @Override
    public void processRecord(Record poiRecord, XlsReadContext readContext) {
        if (readContext.getSstRecord() != null) {
            LabelSSTRecord labelSSTRecord = (LabelSSTRecord) poiRecord;
            readContext.getColumnValueMap().put(labelSSTRecord.getColumn(),
                    readContext.getSstRecord().getString(labelSSTRecord.getSSTIndex()).getString());
        }
    }
}
